package com.diligent.cloud.sfc.resources;

import com.canny.commons.model.Result;
import com.diligent.cloud.sfc.model.OperationCompleteParams;
import com.diligent.cloud.sfc.model.OrderCompleteParams;
import com.diligent.cloud.workorder.model.WoOperation;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.security.Principal;

/**
 * w
 * WoOperation interface
 * 工单/工序资源
 *
 * @author xf107278
 * @date 3/27/2020
 */
@RequestMapping("/sfc")
public interface WoOperationResource {

    @PostMapping("/wo-order-complete")
    @ApiOperation(value = "工单/工单完工处理", notes = "工单/工单完工处理", tags = "工单/工序")
    ResponseEntity<Result> addOrderComplete(@RequestBody OrderCompleteParams completeParams
            , @RequestParam(value = "isHanging",required = false) Boolean isHanging,
                                            @AuthenticationPrincipal Principal principal);

    @PostMapping("/wo-operation")
    @ApiOperation(value = "工序/新增工序单", notes = "工序/新增工序单", tags = "工单/工序")
    ResponseEntity<Result> addOperation(@RequestBody WoOperation woOperation,
                                        @AuthenticationPrincipal Principal principal);

    @PostMapping("/wo-operation-complete")
    @ApiOperation(value = "工序/工序报数", notes = "工序/工序报数", tags = "工单/工序")
    ResponseEntity<Result> addOperationComplete(@RequestBody OperationCompleteParams operationCompleteParams,
                                                @AuthenticationPrincipal Principal principal);
}
